#include <iostream>

using std::cout;
using std::endl;

int main()
{
    int a = 0, b = 2;
    //a为false，整个表达式值为false, b++不会运行
    //具备短路求值特性
    if(a && b++) {
        cout << "if b:" << b << endl;
    } else {
        cout << "else b:" << b << endl;
    }

    //b为true时，整个表达式值为true， ++a不会运行
    //具备短路求值特性
    if(b || ++a) {
        cout << "if a:" << a << endl;
    } else {
        cout <<" else a:" << a << endl;
    }

    return 0;
}

